home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
qbsubs.arc
/
MASTER1.BAS
< prev
next >
Wrap
BASIC Source File
|
1986-10-27
|
10KB
|
252 lines
'******************************************************************************
'* 05/05/86 VER 1.0 *
'* *** MASTER FORMAT FOR **** *
'* *
'* QUICKBASIC *
'* *
'* (c) 1986 by DAVID WESSON, PhD. 238 S. Quaker La. W.Hartford, CT 06119 *
'******************************************************************************
goto TOP
'************************** GENERAL SUBROUTINES *******************************
COMMANDLINE: 'read arguments on DOS command line
com$=command$ 'will not operate within QuickBASIC
length=len(com$) 'screen editor, but from outside
max=(length/2)+1
dim arg$(max)
true=-1:false=0:i=1:num=0:inword=true
while i <= length
ch$=mid$(com$,i,1)
if ch$ <> " " then
if not inword then inword = true
arg$(num) = arg$(num) + ch$
elseif inword then
num =num+1
inword=false
end if
i = i+1
wend
y=1
if not arg$(0)="" then goto BEGINNING
return
DRAWFRAME: 'draws screen frame
locate 1,1,0,8:print chr$(201);string$(77,205);chr$(187)
for x=2 to 22:locate x,79:print chr$(186):next
for x=22 to 2 step -1:locate x,1:print chr$(186):next
locate 23,1:print chr$(200);string$(77,205);chr$(188)
return
DRAW3:
locate 3:print chr$(199);string$(77,196);chr$(182):return
DRAW21:
locate 21:print chr$(199);string$(77,196);chr$(182):return
CLEARALL:
for x=20 to 4 step -1:locate x,2:print string$(77,0):next:return
CLEAR22:
locate 22,2:print string$(77,0):return
PRESS:
gosub CLEAR22
locate 22,27:print "PRESS ANY KEY TO CONTINUE "
IN:
w$=inkey$:if w$="" then goto IN else return
ENTER:
gosub IN
answer$=w$:if answer$=enter$ then return
goto ENTER
ANOTHER:
gosub CLEAR22
locate 22,25: print "WANT TO DO ANOTHER? ( Y or N )"
gosub YESNO
YESNO:
gosub IN
if w$="Y" or w$="y" then yn$="y":return
if w$="N" or w$="n" then yn$="n":return
goto YESNO
BANNER:
'input message, banner length and location, and escape character
mlen=40:row=10:col=20:stop$=esc$
m$="Hit [Esc] to exit"
locate row,col:color 0,7:print string$(mlen,46)
banstart:
for z=1 to len(m$)
n=n+1:newcol=col+mlen-n
locate row,col:print right$(m$,len(m$)-n);chr$(46)
locate row,newcol:print left$(m$,n);chr$(46)
for i=1 to 400:next i 'viewing scroll delay
if inkey$=stop$ then color 7,0:return
next z
for y=1 to mlen-len(m$)
p=p+1:newcol=col+mlen-len(m$)-p
locate row,newcol:print m$;chr$(46)
for i=1 to 400:next i
if inkey$=stop$ then color 7,0:return
next y
n=0:p=0:newcol=0
goto banstart
return
'------------------------- SET UP KEY and COLOR NAMES -------------------------
SETNAMES:
DISABLE:
defint a-z
key off
for i=1 to 10:key i,"":next
NAMEKEYS:
PGUP$ = chr$(0)+chr$(73)
PGDOWN$ = chr$(0)+chr$(81)
HOME$ = chr$(0)+chr$(71)
ENTER$= chr$(13)
BKSP$ = chr$(8)
ESC$ = chr$(27)
F1$ = chr$(0)+chr$(59) : F2$ = chr$(0)+chr$(60)
F3$ = chr$(0)+chr$(61) : F4$ = chr$(0)+chr$(62)
F5$ = chr$(0)+chr$(63) : F6$ = chr$(0)+chr$(64)
F7$ = chr$(0)+chr$(65) : F8$ = chr$(0)+chr$(66)
F9$ = chr$(0)+chr$(67) : F10$= chr$(0)+chr$(68)
UP$ = chr$(0)+chr$(72)
LFT$ = chr$(0)+chr$(14)
RGHT$= chr$(0)+chr$(77)
DOWN$ = chr$(0)+chr$(80)
NAMECOLORS:
BLACK = 0:GRAY = 8
BLUE = 1:LTBLUE= 9
GREEN = 2:LTGREEN=10
CYAN = 3:LTCYAN= 11
RED = 4:LTRED = 12
MAGENTA=5:LTMAGENTA=13
BROWN = 6:YELLOW=14
WHITE = 7:LTWHITE= 15
BLINK= 16 'use w/color ie black+blink gives you blinking black
return
'---------------------- GET INPUT FROM KEYBOARD --------------------------------
ANSWER:
answer$=""
inrow=csrlin:incol=pos(0):inlen=78-incol
BYTEIN:
byte$=inkey$:if byte$="" then goto BYTEIN
if byte$=ENTER$ then return
if byte$=BKSP$ goto BACKSPACE
if byte$=PGUP$ or byte$=HOME$ then answer$=byte$:return
if byte$>=F1$ and byte$<=F10$ then answer$=answer$+byte$:return
if len(answer$)=inlen then return 'check if any more room
locate inrow,incol+len(answer$):_ 'set for first keystroke
print byte$;:answer$=answer$+byte$ 'echo keystroke
goto BYTEIN
BACKSPACE:
if answer$="" then goto BYTEIN 'entry empty
print chr$(29);" ";chr$(29); 'bksp and blank out answer
answer$=left$(answer$,len(answer$)-1) 'delete last char answer$
goto BYTEIN
return
'-------------------------------------------------------------------------------
SHIFT: 'converts answer$ to CAPITALS
for i=1 to len(answer$)
if asc(mid$(answer$,i,1))>96 and asc(mid$(answer$,i,1))<123 then
mid$(answer$,i,1) = chr$( asc(mid$(answer$,i,1)) - 32)
end if
next:return
DRAWBOX:
' must give parameters of height, length, and starting position
locate 1,1,0
length = 80:height = 24:startrow = 1:startcol = 1
l$=string$(length-2,205):j=startcol+length-1
locate startrow,startcol:print chr$(201)+l$+chr$(187) ' top
for i=startrow+1 to startrow+(height-2) ' sides
locate i,startcol:print chr$(186)
locate i,j :print chr$(186)
next i
locate i,startcol:print chr$(200)+l$+chr$(188); ' bottom
locate 1,1,1
return
MOVEARROW:
' the following line gives an example of parameters needed
begin%=56:limit%=25:row%=15:increm%=-1:arrow$=string$(2,174) '««
locate 1,1,0 'turns cursor off
for i%=begin% to limit% step increm%
da%=screen(row%,i%):db%=screen(row%,i%+1)
locate row%,i%:print arrow$;:sound 2000,.5:sound 32767,2
locate row%,i%:print chr$(da%) chr$(db%);
' if i% = 39 and bucket$ = "yes" then color 2,0 gosub XXXX
next i%
locate 1,1,1
return
FKEYS:
'key(1) on:on key(1) gosub HITF1
'key(2) on:on key(2) gosub HITF2
'key(3) on:on key(3) gosub HITF3
'key(4) on:on key(4) gosub HITF4
'key(5) on:on key(5) gosub HITF5
'key(6) on:on key(6) gosub HITF6
'key(7) on:on key(7) gosub HITF7
'key(8) on:on key(8) gosub HITF8
'key(9) on:on key(9) gosub HITF9
'key(10) on:on key(10) gosub HITF10
return
'--------------------------- HIT FUNCTION KEY --------------------------------
HITF1:
locate 22,20:color 15
print "Hit X to EXIT, any other key to BEGIN again.",e$
color 7
gosub IN
if w$="X" or w$="x" then end else goto BEGINNING
close:cls
return
'******************************************************************************
TOP:
goto MAIN 'bypass for opening screen
gosub FKEYS
gosub SETNAMES
gosub DRAWFRAME
gosub DRAW3
gosub DRAW21
locate 1,27:print "[put program name here]"
locate 3,31:color 15:print"[ INTRODUCTION ]":color 7
locate 6,10:print "
locate 7,10:print "
locate 8,10:print "
locate 9,10:print "
locate 10,10:print"
locate 11,10:print"
locate 12,10:print"
locate 13,10:print"
locate 14,10:print"
locate 16,20:print"(c) Copyright 1986 David A. Wesson
locate 17,20:print" 238 South Quaker Lane
locate 18,20:print" W. Hartford, CT 06119 203-523-1873"
locate 19,20:print" Written for the public domain in QuickBASIC."
locate 20,20:print" No charges or liabilities accepted."
locate 22,20:color 15
print "Would you like to proceed? ( Y or N ) ":color 7
gosub YESNO
if yn$="y" then goto BEGINNING
gosub CLEARALL
gosub CLEAR22
locate 15,25:print "OK, thanks for stopping by.":locate 24,1:system
BEGINNING:
color 7,0:close
gosub CLEARALL
gosub CLEAR22
'***************************** MAIN PROGRAM HERE *******************************
MAIN:
gosub SETNAMES
gosub BANNER
'**************************** ERROR HANDLING ROUTINES **************************
NOFIND:
locate 22,13:color 15
print"No file by that name found, please fix and restart"
color 7
end:system
FINISH:
locate 16,32:print "Finish time: ";time$
locate 18,20:print y;" lines processed. Task completed"
HELP:
print"
print"
print"
print"
print"
print"
print"
print"
print"
print"